package web_programing.review.Tcp;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author haomin
 * @date 2022/09/26 10:30
 **/
public class Log {
    public static void println(Object o){
        Date date = new Date();
        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
        String now = dateFormat.format(date);
        String name = Thread.currentThread().getName();
        System.out.println(now + ": " + name + ": "+ o.toString());
    }

    public static void print(Object o){
        Date date = new Date();
        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
        String now = dateFormat.format(date);
        String name = Thread.currentThread().getName();
        System.out.print(now + ": " + name + ": "+ o.toString());
    }

    public static void printf(String fmt, Object... args){
        Date date = new Date();
        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
        String now = dateFormat.format(date);
        String name = Thread.currentThread().getName();

        System.out.printf(now + ": " + name + ": "+ fmt, args);
    }

    public static void main(String[] args) {
        println("hello word");
        print("hello word\r\n");
        printf("%s","hello word");
    }
}